<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%
	if (session.getAttribute("account") == null) {
		response.sendRedirect("index.jsp");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人信息管理系统</title>
<link rel="stylesheet" type="text/css"
	href="css/css<s:property value="#session.account.theme"/>/echead.css" />
<link rel="stylesheet" type="text/css"
	href="css/css<s:property value="#session.account.theme"/>/appointmentEdit.css" />
<script type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript">
	$(function() {
		var date = $("#ad").val().split("-");
		for ( var i = 0; i < $("#dueYear").children().size(); i++) {
			if ($("#dueYear").children().eq(i).val() == date[0]) {
				$("#dueYear").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#dueMonth").children().size(); i++) {
			if ($("#dueMonth").children().eq(i).val() == date[1]) {
				$("#dueMonth").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#dueDay").children().size(); i++) {
			if ($("#dueDay").children().eq(i).val() == date[2]) {
				$("#dueDay").children().eq(i).attr("selected", "selected");
			}
		}

		var stime = $("#st").val().split(" ");
		for ( var i = 0; i < $("#stHour").children().size(); i++) {
			if ($("#stHour").children().eq(i).val() == stime[0].split(":")[0]) {
				$("#stHour").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#stMinute").children().size(); i++) {
			if ($("#stMinute").children().eq(i).val() == stime[0].split(":")[1]) {
				$("#stMinute").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#stAP").children().size(); i++) {
			if ($("#stAP").children().eq(i).val() == stime[1]) {
				$("#stAP").children().eq(i).attr("selected", "selected");
			}
		}

		var etime = $("#et").val().split(" ");
		for ( var i = 0; i < $("#endHour").children().size(); i++) {
			if ($("#endHour").children().eq(i).val() == etime[0].split(":")[0]) {
				$("#endHour").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#endMinute").children().size(); i++) {
			if ($("#endMinute").children().eq(i).val() == etime[0].split(":")[1]) {
				$("#endMinute").children().eq(i).attr("selected", "selected");
			}
		}
		for ( var i = 0; i < $("#endAP").children().size(); i++) {
			if ($("#endAP").children().eq(i).val() == etime[1]) {
				$("#endAP").children().eq(i).attr("selected", "selected");
			}
		}

		$("#savebutton").click(
				function() {
					$("#ad").val(
							$("#dueYear").val() + "-" + $("#dueMonth").val()
									+ "-" + $("#dueDay").val());
					$("#st").val(
							$("#stHour").val() + ":" + $("#stMinute").val()
									+ ":" + $("#stAP").val());
					$("#et").val(
							$("#endHour").val() + ":" + $("#endMinute").val()
									+ ":" + $("#endAP").val());
					$("#appointmentUpdateForm").submit();
				});
	});
</script>
</head>

<body>
	<div id="menu">
		<ul>
			<a href="dayAtAGlanceAction"><li id="dayAtAGlance"></li> </a>
			<a href="noteList" />
			<li id="notes"></li>
			</a>
			<a href="taskList"><li id="tasks"></li> </a>
			<a href="contactList"><li id="contacts"></li> </a>
			<a href="appointmentList"><li id="appointments"></li> </a>
			<a href="accountEditShow"><li id="myAccount"></li> </a>
			<a href="logoff"><li id="logoff"></li> </a>
			<a href="cgtheme?theme=1"><li id="skin1"></li> </a>
			<a href="cgtheme?theme=2"><li id="skin2"></li> </a>
			<a href="cgtheme?theme=3"><li id="skin3"></li> </a>
		</ul>
		<div id="logo"></div>
	</div>

	<div id="main">
		<div id="secontmenu">
			<ul>
				<a href="appointmentForware?operate=create">
					<li id="newappointment"></li> </a>
				<a href="appointmentList?view=day">
					<li id="dayview"></li> </a>
				<a href="appointmentList?view=week">
					<li id="weekview"></li> </a>
				<a href="appointmentList?view=month">
					<li id="monthview"></li> </a>
				<a href="appointmentList?view=year">
					<li id="yearview"></li> </a>
			</ul>
		</div>
		<div id="content">
			<div id="title"></div>
			<div id="appointmentedit">编辑计划：</div>
			<div id="appointmenteditform">
				<form id="appointmentUpdateForm" method="post"
					action="appointmentUpdate">
					<p id="subject">
						<span> 主题：</span> <input id="subject" type="text"
							name="appointment.subject"
							value="<s:property value="appointment.subject"/>" />
					</p>
					<p id="address">
						<span> 地点：</span> <input id="address" type="text"
							name="appointment.location"
							value="<s:property value="appointment.location"/>" />
					</p>
					<input id="app_id" type="hidden" name="appointment.app_id"
						value="<s:property value="appointment.app_id"/>" /> <input
						id="ad" type="hidden" name="appointment.appointmentDate"
						value="<s:date name="appointment.appointmentDate" format="yyyy-MM-dd"/>" />
					<input id="st" type="hidden" name="appointment.startTime"
						value="<s:date name="appointment.startTime" format="hh:mm a"/>" />
					<input id="et" type="hidden" name="appointment.endTime"
						value="<s:date name="appointment.endTime" format="hh:mm a"/>" />
					<p id="time">
						<span> 时间：</span> <select id="dueMonth" name="dueMonth">
							<option value=""></option>
							<option value="01">一月</option>
							<option value="02">二月</option>
							<option value="03">三月</option>
							<option value="04">四月</option>
							<option value="05">五月</option>
							<option value="06">六月</option>
							<option value="07">七月</option>
							<option value="08">八月</option>
							<option value="09">九月</option>
							<option value="10">十月</option>
							<option value="11">十一月</option>
							<option value="12">十二月</option>
						</select> <select id="dueDay" name="dueDay">
							<option value=""></option>
							<option value="01">01</option>
							<option value="02">02</option>
							<option value="03">03</option>
							<option value="04">04</option>
							<option value="05">05</option>
							<option value="06">06</option>
							<option value="07">07</option>
							<option value="08">08</option>
							<option value="09">09</option>
							<option value="10">10</option>
							<option value="11">11</option>
							<option value="12">12</option>
							<option value="13">13</option>
							<option value="14">14</option>
							<option value="15">15</option>
							<option value="16">16</option>
							<option value="17">17</option>
							<option value="18">18</option>
							<option value="19">19</option>
							<option value="20">20</option>
							<option value="21">21</option>
							<option value="22">22</option>
							<option value="23">23</option>
							<option value="24">24</option>
							<option value="25">25</option>
							<option value="26">26</option>
							<option value="27">27</option>
							<option value="28">28</option>
							<option value="29">29</option>
							<option value="30">30</option>
							<option value="31">31</option>
						</select> <select id="dueYear" name="dueYear">
							<option value=""></option>
							<option value="2006">2006</option>
							<option value="2007">2007</option>
							<option value="2008">2008</option>
							<option value="2009">2009</option>
							<option value="2010">2010</option>
							<option value="2011">2011</option>
							<option value="2012">2012</option>
							<option value="2013">2013</option>
							<option value="2014">2014</option>
							<option value="2015">2015</option>
							<option value="2016">2016</option>
							<option value="2017">2017</option>
							<option value="2018">2018</option>
							<option value="2019">2019</option>
							<option value="2020">2020</option>
						</select>
					</p>
					<p id="starttime">
						<span>开始时间：</span> <select id="stHour" name="hour">
							<option value=""></option>
							<option value="01">1</option>
							<option value="02">2</option>
							<option value="03">3</option>
							<option value="04">4</option>
							<option value="05">5</option>
							<option value="06">6</option>
							<option value="07">7</option>
							<option value="08">8</option>
							<option value="09">9</option>
							<option value="10">10</option>
							<option value="11">11</option>
							<option value="12">12</option>
						</select> <select id="stMinute" name="minute">
							<option value=""></option>
							<option value="00">00</option>
							<option value="30">30</option>
						</select> <select id="stAP" name="AP">
							<option value=""></option>
							<option value="AM">AM</option>
							<option value="PM">PM</option>
						</select>
					</p>

					<p id="endtime">
						<span>结束时间：</span> <select id="endHour" name="hour">
							<option value=""></option>
							<option value="01">1</option>
							<option value="02">2</option>
							<option value="03">3</option>
							<option value="04">4</option>
							<option value="05">5</option>
							<option value="06">6</option>
							<option value="07">7</option>
							<option value="08">8</option>
							<option value="09">9</option>
							<option value="10">10</option>
							<option value="11">11</option>
							<option value="12">12</option>
						</select> <select id="endMinute" name="minute">
							<option value=""></option>
							<option value="00">00</option>
							<option value="30">30</option>
						</select> <select id="endAP" name="AP">
							<option value=""></option>
							<option value="AM">AM</option>
							<option value="PM">PM</option>
						</select>
					</p>
					<p id="comment">
						<span> 内容：</span>
						<textarea id="contents" name="appointment.comments"><s:property value="appointment.comments" /></textarea>
					</p>
					<div id="savebutton"></div>
				</form>
			</div>
		</div>
	</div>
</body>
</html>
